package com.hejia.alauda.utils;

import java.io.InputStream;
import java.util.Properties;

/**
 * 
 * 连连支付配置帮助类
 * 
 *
 *
 * Created by showone on 2014 下午2:29:49.
 */
public class LLPayConfig {
	private static LLPayConfig instance = null;

	private Properties properties = null;

	private LLPayConfig() {
		init();
	}

	public static LLPayConfig getInstance() {

		if (instance == null) {
			instance = new LLPayConfig();
		}
		return instance;
	}

	/**
	 * 初始化配置文件
	 */
	public void init() {

		try {
			InputStream is = LLPayConfig.class
					.getResourceAsStream("/llp_config.properties");
			properties = new Properties();
			properties.load(is);

		} catch (Exception e) {
			throw new RuntimeException("Failed to get properties!");
		}
	}

	/**
	 * 根据key值取得对应的value值
	 * 
	 * @param key
	 * @return
	 */
	public String getValue(String key) {
		return properties.getProperty(key);
	}

	/**
	 * @return the properties
	 */
	public Properties getProperties() {
		return properties;
	}
}
